package by.yativem.ins.web.templates;

import javax.servlet.ServletContext;

import org.apache.struts2.views.freemarker.FreemarkerManager;

import freemarker.template.Configuration;
import freemarker.template.TemplateException;

public class InsFreemarkerManager extends FreemarkerManager {
	
	@Override
    protected Configuration createConfiguration(ServletContext servletContext) throws TemplateException {
        //configureDefaultConfiguration(configuration, servletContext);
        Configuration configuration = super.createConfiguration(servletContext);
        
        configuration.addAutoImport("ins", "/ftl/includes/ins-macros.ftl");
        return configuration;
    }
	
	
    protected void configureDefaultConfiguration(Configuration configuration, ServletContext servletContext) {
    /*    configuration.setCacheStorage(new StrongCacheStorage());
        configuration.setTemplateExceptionHandler(getTemplateExceptionHandler());
        configuration.setObjectWrapper(getJieObjectWrapper());
        configuration.setOutputEncoding(JieGlobals.getCharacterEncoding());
        configuration.setDefaultEncoding(JieGlobals.getCharacterEncoding());
      */
        configuration.addAutoImport("jie", "/template/global/include/jie-macros.ftl");
      //  configuration.setLocalizedLookup(false);
      /*  configuration.setSharedVariable("jbody", bodyDirective);
        configuration.setSharedVariable("jhead", headDirective);
       */ 
    //    loadSettings(servletContext, configuration);
    }

}
